Whack extension from Bushenell waypoints if given.
authorrobertl <robertl>
Sat, 13 Mar 2010 17:53:04 +0000 (17:53 +0000)
committerrobertl <robertl>
Sat, 13 Mar 2010 17:53:04 +0000 (17:53 +0000)
bushnell.c

index 2452975ced0cc4a099edd58745e499fc51d6af51..5bcdea8213dcbeafa50f8ff0b8eca12efb967dbc 100644 (file)
@@ -24,7 +24,7 @@
 #define MYNAME "Bushnell"
 
 static gbfile *file_in;
-static const char *ofname;
+static char *ofname;
 static short_handle mkshort_handle = NULL; 
 
 static
@@ -157,7 +157,14 @@ rd_deinit(void) {
 
 static void
 wr_init(const char *fname) {
-  ofname = fname;
+  char *dot;
+
+  ofname = xstrdup(fname);
+
+  // If user provided an extension, whack it.
+  dot = strchr(ofname, '.');
+  if (dot) *dot = 0;
+
   static char valid_chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789"
                ".-/\\~@#$%^&*()_+=<>"
                 "abcdefghijklmnopqrstuvwxyz";
@@ -170,7 +177,7 @@ wr_init(const char *fname) {
 static void
 wr_deinit(void) {
   mkshort_del_handle(&mkshort_handle);
-  
+  xfree(ofname);
 }
 
 /*